import pandas as pd
import json

nav_df = pd.read_csv('./data/nav_150_10.csv')


def get_index_data():
    account = "001"
    start_day = "2018-08-01"  # robot2 正式稳定运行


    profit_map_dict = dict()
    profit_map_dict["all"] = dict()
    profit_map_dict["all"]["date_list"] = nav_df['date'].tolist()
    profit_map_dict["all"]["ratio_list"] = nav_df['nav'].tolist()
    profit_map_dict["all"]["szzs_list"] = nav_df['nav(hold_btc)'].tolist()
    profit_map_dict["season"] = dict()
    profit_map_dict["season"]["date_list"] = nav_df['date'].tolist()[-1000:]
    profit_map_dict["season"]["ratio_list"] = nav_df['nav'].tolist()[-1000:]
    profit_map_dict["season"]["szzs_list"] = nav_df['nav(hold_btc)'].tolist()[-1000:]
    profit_map_dict["month"] = dict()
    profit_map_dict["month"]["date_list"] = nav_df['date'].tolist()[-500:]
    profit_map_dict["month"]["ratio_list"] = nav_df['nav'].tolist()[-500:]
    profit_map_dict["month"]["szzs_list"] =  nav_df['nav(hold_btc)'].tolist()[-500:]

    result = dict()
    result["total_profit"] = 10
    result["month_profit"] = 10
    result["week_profit"] = 10
    result["today_profit"] = 10
    result["yesterday_profit"] = 10
    result["net_value"] = 1.1
    result["win_szzs"] = 0.1
    result["max_day_profit"] = 10
    result["min_day_profit"] = 10
    result["max_stock_profit"] = 10
    result["min_stock_profit"] = 10
    result["frequency"] = 3
    result["stock_position"] = 5
    result["cash_position"] = 6
    result["profit_map_dict"] = profit_map_dict

    json_name = "index_data.json"
    with open(json_name, 'w') as fp:
        json.dump(result, fp)
    print('生成成功')
    print(str(result))


get_index_data()

